package com.kiragame.xchat.object;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

public class AutoChatResponse {
	private String response;
	private Integer id;
	private Integer result;
	private String msg;

	public String getResponse() {
		return response;
	}

	public void setResponse(String response) {
		this.response = response;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getResult() {
		return result;
	}

	public void setResult(Integer result) {
		this.result = result;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String toJson() {
		return new JSONSerializer().exclude("*.class").deepSerialize(this);
	}

	public static AutoChatResponse fromJsonToAutoChatResponse(String json) {
		return new JSONDeserializer<AutoChatResponse>().use(null,
				AutoChatResponse.class).deserialize(json);
	}

	public static String toJsonArray(Collection<AutoChatResponse> collection) {
		return new JSONSerializer().exclude("*.class")
				.deepSerialize(collection);
	}

	public static Collection<AutoChatResponse> fromJsonArrayToAutoChatResponses(
			String json) {
		return new JSONDeserializer<List<AutoChatResponse>>()
				.use(null, ArrayList.class).use("values", User.class)
				.deserialize(json);
	}
}
